package com.tte.common.designpattern.abstractfactory;

import com.tte.common.designpattern.service.Place;
import com.tte.common.designpattern.service.Shopping;
import com.tte.common.designpattern.service.impl.ShopCommputerImpl;
import com.tte.common.designpattern.service.impl.ShopFoodsImpl;
import com.tte.common.designpattern.service.impl.ShopPhoneImpl;

/**
 * 商品工厂
 * @Description: 创建一个工厂，生成基于给定信息的实体类的对象。
 * @Author: DongWH
 */
public class ShoppingFactoryAbstract extends AbstractFactory{

    /**
     * 使用 getShape 方法获取形状类型的对象
     * @param shapeType
     * @return
     */
    @Override
    public Shopping getShopping(String shapeType){
        if(shapeType == null){
            return null;
        }
        if(shapeType.equalsIgnoreCase("phone")){
            return new ShopPhoneImpl();
        } else if(shapeType.equalsIgnoreCase("foods")){
            return new ShopFoodsImpl();
        } else if(shapeType.equalsIgnoreCase("commputer")){
            return new ShopCommputerImpl();
        }
        return null;
    }
    @Override
    public Place getPlace(String place){
        return null;
    }
}
